Perform any of a set of simple actions on the Browser.
#include <IE.au3>
_IEAction ( ByRef $o_object, $s_action )
Parameters
$o_object | Object variable of an InternetExplorer.Application |
$s_action | Action selection (see remarks) |
Return Value
Success: | Returns 1 |
Failure: | Returns 0 and sets @ERROR |
@Error: | 0 ($_IEStatus_Success) = No Error |
3 ($_IEStatus_InvalidDataType) = Invalid Data Type | |
4 ($_IEStatus_InvalidObjectType) = Invalid Object Type | |
5 ($_IEStatus_InvalidValue) = Invalid Value | |
@Extended: | Contains invalid parameter number |
Remarks
Action | Description |
"back" | Navigates backward one item in the history list. |
"blur" | Causes the element to lose focus, but does not set focus on the next element in the tab order. |
"click" | Simulates a click on the specified element. |
"copy" | Copies the current selection to the clipboard. |
"cut" | Copies the current selection to the clipboard and then deletes it. |
"delete" | Deletes the current selection. |
"disable" | Disables the specified element. |
"enable" | Enables the specified element. |
"focus" | Causes the element to receive focus. |
"forward" | Navigates forward one item in the history list. |
"home" | Navigates to the current home or start page. |
"invisible" | Sets an object state to hidden. |
"paste" | Overwrites the contents of the clipboard on the current selection. |
"print" | Opens the print dialog box so the user can print the current page. |
"printdefault" | Print directly to default printer (no dialog) |
"quit" | Closes the object. |
"refresh" | Refreshes the current document. |
"saveas" | Opens a dialog box to save the current Web page to a file. |
"search" | Navigates to the current search page. |
"selectall" | Selects the entire document. |
"stop" | Cancels any pending navigation or download operation and stops any dynamic page elements, such as background sounds and animations. |
"unselect" | Clears the current selection. |
"visible" | Sets an object state to visible. |
Related
_IEPropertySet
Example
; *******************************************************
; Example 1 - Open a browser with the "form" example, get a reference
; to the submit button by name and "click" it. This technique
; of submitting forms is useful because many forms rely on JavaScript
; code and "onClick" events on their submit button making _IEFormSubmit()
; not perform as expected
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oSubmit = _IEGetObjByName ($oIE, "submitExample")
_IEAction ($oSubmit, "click")
_IELoadWait ($oIE)
; *******************************************************
; Example 2 - Same as Example 1, except instead of using click, give the element focus
; and then use ControlSend to send Enter. Use this technique when the
; browser-side scripting associated with a click action prevents control
; from being automatically returned to your code.
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oSubmit = _IEGetObjByName ($oIE, "submitExample")
$hwnd = _IEPropertyGet($oIE, "hwnd")
_IEAction ($oSubmit, "focus")
ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}")
; Wait for Alert window, then click on OK
WinWait("Windows Internet Explorer", "ExampleFormSubmitted")
ControlClick("Windows Internet Explorer", "ExampleFormSubmitted", "[CLASS:Button; TEXT:OK; Instance:1;]")
_IELoadWait ($oIE)